﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RBOSS.Data;


namespace RBOSS.Business.VendorModule
{
   public class vendorproducts
    {
        public int ProductId { get; set; }
        public int UserId { get; set; }
        public int CategoryId { get; set; }
        public string ProductName { get; set; }
        public decimal UnitPrice { get; set; }
        public string Image { get; set; }
        public int Quantity { get; set; }
        public string Description { get; set; }
        RBOSSEntities rb = new RBOSSEntities();
       public List<vendorproducts> getproductlist(int userid)
        {
            List<vendorproducts> lstproduct = new List<vendorproducts>();
            var query = rb.Products.Where(e => e.UserId == userid);
            vendorproducts prod;
           foreach (var item in query)
            {
                prod = new vendorproducts();
                prod.ProductId = item.ProductId;
                prod.Image = item.Image;
                prod.Quantity = item.Quantity;
                prod.UnitPrice = item.UnitPrice;
                prod.Description = item.Description;
                prod.CategoryId = prod.CategoryId;
                lstproduct.Add(prod);
            }

           return lstproduct;
        }
    }
}
